home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 5705 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: cea.fr!usenet
  2. From: Xavier Tarrago <tarrago@lcus15.saclay.cea.fr>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Performance: C vs. C++
  5. Date: 6 Feb 1996 13:13:06 GMT
  6. Organization: CEA Commissariat a l'Energie Atomique, France.
  7. Message-ID: <4f7k52$4u4@news.cea.fr>
  8. References: <30F6BAAC.12B5@iastate.edu> <4da9pn$a45@news.bridge.net> <4dnpl2$c8g@classic.iinet.com.au> <31032A4F.6695@iastate.edu> <3108F495.4828@enermet.fi> <DLt9u3.FnJ@mv.mv.com>
  9. NNTP-Posting-Host: lcus15.saclay.cea.fr
  10.  
  11.   I didn't read the begenning of this thread but its subject seems
  12. interesting to me. So...
  13.   I found some difference between C & C++ perf.
  14.   I tried to use Complex class to realize FFT algoritm. I found C
  15. implementation
  16. /* Complex */
  17. double re;
  18. double im;
  19. ..
  20.  
  21.   2 time faster than C++
  22. complex<double> c;
  23.  
  24.   I think that it is due to better optimisation of
  25. re3 = re1*re2 - im1*im2;
  26. im3 = re1*im2 + re2*im1;
  27.   than
  28. c3 = c2 * c1;
  29.   because of construction of temporaries.
  30.  
  31.   The first implementation gave the same perf in C & C++
  32.   But using complex objects was much slower.
  33.  
  34.   I wonder if someone tried to implement some scientific library
  35. whith C++ and compared perf versus some similar lib in C
  36.  
  37.   X. Tarrago
  38.